﻿@model IEnumerable<WebApplication1.Models.ExamResult>

@{
    ViewBag.Title = "考试结果管理";
}

<h2>考试结果管理</h2>

<table class="table table-striped table-bordered">
    <thead>
        <tr>
            <th>员工姓名</th>
            <th>部门</th>
            <th>得分</th>
            <th>总分</th>
            <th>考试时间</th>
            <th>操作</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td>@Html.DisplayFor(modelItem => item.User.Name)</td>
                <td>@Html.DisplayFor(modelItem => item.User.Department)</td>
                <td>@Html.DisplayFor(modelItem => item.Score)</td>
                <td>@Html.DisplayFor(modelItem => item.TotalScore)</td>
                <td>@Html.DisplayFor(modelItem => item.ExamDate)</td>
                <td>
                    <button class="btn btn-info btn-sm" onclick="showDetails(@item.ResultId)">查看详情</button>
                </td>
            </tr>
        }
    </tbody>
</table>

<!-- 详情模态框 -->
<div class="modal fade" id="detailsModal" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">考试详情</h4>
            </div>
            <div class="modal-body" id="detailsContent">
                <!-- 详情内容将通过AJAX加载 -->
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>

<script>function showDetails(resultId) {
        // 这里可以实现详细信息的加载
        $('#detailsContent').html('<p>详细信息功能待实现</p>');
        $('#detailsModal').modal('show');
    }</script>